RadarSimPyis a radar simulation package built with python. Contact me if you are interested in this module.
RadarSimCis the ray tracing engine built with C++. It is capabile of generating the point cloud of a customized scenet. This engine can be directly called from Python.
This ray tracing engine can be used to effective calculation the RCS of a target. It can also be used generate point cloud in a customized scene.
This notebook is available on my GitHub.
A scene can be created from multiple .stl models.
In this example, 5 objects will be loaded:
import numpy as np
ground = {
'model': 'surface_60x60.stl',
'location': (0, 0, 0),
'rotation_axis': (0, 0, 0),
'rotation_angle': 0,
'speed': (0, 0, 0)
}
car_1 = {
'model': 'audi_r8.stl',
'location': (0, 10, 0),
'rotation_axis': (0, 0, 0),
'rotation_angle': 0,
'speed': (0, 0, 0)
}
car_2 = {
'model': 'audi_r8.stl',
'location': (-4, 0, 0),
'rotation_axis': (0, 0, 0),
'rotation_angle': 0,
'speed': (0, 0, 0)
}
car_3 = {
'model': 'audi_r8.stl',
'location': (4, -5, 0),
'rotation_axis': (0, 0, 0),
'rotation_angle': 0,
'speed': (0, 0, 0)
}
car_4 = {
'model': 'audi_r8.stl',
'location': (0, -5, 0),
'rotation_axis': (0, 0, 0),
'rotation_angle': 0,
'speed': (0, 0, 0)
}
targets = [ground, car_1, car_2, car_3, car_4]
Now, use dict to define a Lidar. It has 3 properties:
lidar = {
'position': [0, 0, 1.5],
'phi': np.arange(0, 360, 0.2),
'theta': np.arange(70, 110, 0.5)
}
To generate the point cloud, we can simply use lidar_scene. It will create an numpy array of the point cloud.
import time
from radarsimpy import lidar_scene
tic = time.time()
points = lidar_scene(lidar, targets)
toc = time.time()
print('Exection time:', toc-tic, 's')
import plotly.graph_objs as go
ray_dots = go.Scatter3d(x=points['positions'][:, 0], y=points['positions'][:, 1], z=points['positions'][:, 2], mode='markers',
marker=dict(
size=1,
color=points['positions'][:, 2],
colorscale='Rainbow',
opacity=0.5,
),)
layout = go.Layout(
height=800,
template='plotly_dark',
scene=dict(
aspectmode='data',
)
)
fig = go.Figure(data=[ray_dots], layout=layout)
fig.show()